From 05a16d62a9c476ad8dee9095c7174b90c696a020 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2004 16:38:57 +0000 Subject: [PATCH] Use a row reference, not a path, to associate separators with their tree 2004-11-09 Matthias Clasen * gtk/gtkcombobox.c (find_menu_by_path) (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): Use a row reference, not a path, to associate separators with their tree row. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkcombobox.c | 22 +++++++++++++--------- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a0b4e2c2e..4d6f44551b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-11-09 Matthias Clasen + * gtk/gtkcombobox.c (find_menu_by_path) + (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): + Use a row reference, not a path, to associate separators + with their tree row. + * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): Show the grip_window if necessary. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3a0b4e2c2e..4d6f44551b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,10 @@ 2004-11-09 Matthias Clasen + * gtk/gtkcombobox.c (find_menu_by_path) + (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): + Use a row reference, not a path, to associate separators + with their tree row. + * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): Show the grip_window if necessary. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3a0b4e2c2e..4d6f44551b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,10 @@ 2004-11-09 Matthias Clasen + * gtk/gtkcombobox.c (find_menu_by_path) + (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): + Use a row reference, not a path, to associate separators + with their tree row. + * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): Show the grip_window if necessary. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3a0b4e2c2e..4d6f44551b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,10 @@ 2004-11-09 Matthias Clasen + * gtk/gtkcombobox.c (find_menu_by_path) + (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): + Use a row reference, not a path, to associate separators + with their tree row. + * gtk/gtkstatusbar.c (gtk_statusbar_set_has_resize_grip): Show the grip_window if necessary. diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 9a4976a24a..c8cca85d81 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2384,6 +2384,7 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box, gboolean is_separator; gint i, n_children; GtkWidget *last; + GtkTreePath *path; n_children = gtk_tree_model_iter_n_children (model, parent); @@ -2401,10 +2402,11 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box, if (is_separator) { item = gtk_separator_menu_item_new (); + path = gtk_tree_model_get_path (model, &iter); g_object_set_data_full (G_OBJECT (item), "gtk-combo-box-item-path", - gtk_tree_model_get_path (model, &iter), - (GDestroyNotify)gtk_tree_path_free); + gtk_tree_row_reference_new (model, path), + (GDestroyNotify)gtk_tree_row_reference_free); } else { @@ -2754,6 +2756,7 @@ find_menu_by_path (GtkWidget *menu, GList *i, *list; GtkWidget *item; GtkWidget *submenu; + GtkTreeRowReference *mref; GtkTreePath *mpath; gboolean skip; @@ -2764,12 +2767,13 @@ find_menu_by_path (GtkWidget *menu, { if (GTK_IS_SEPARATOR_MENU_ITEM (i->data)) { - - mpath = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path"); - if (!mpath) + mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path"); + if (!mref) continue; - - mpath = gtk_tree_path_copy (mpath); + else if (!gtk_tree_row_reference_valid (mref)) + mpath = NULL; + else + mpath = gtk_tree_row_reference_get_path (mref); } else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child)) { @@ -2914,8 +2918,8 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model, item = gtk_separator_menu_item_new (); g_object_set_data_full (G_OBJECT (item), "gtk-combo-box-item-path", - gtk_tree_path_copy (path), - (GDestroyNotify)gtk_tree_path_free); + gtk_tree_row_reference_new (model, path), + (GDestroyNotify)gtk_tree_row_reference_free); } else { -- 2.30.2